
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<%@ page import="com.gph.saviorframework.common.model.User" %>
<%@ page import="org.apache.shiro.SecurityUtils" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
  pageContext.setAttribute("base", basePath);
  String Error_Message = (String) request.getSession().getAttribute("err");
  request.getSession().removeAttribute("err");
  response.setHeader("progma", "no-cache");
  response.setHeader("Cache-Control", "no-cache");
  response.setHeader("Cache-Control", "no-store");
  response.setDateHeader("Expires", 0);
%>
<!DOCTYPE html>
<html lang="en">
<head>
  <link href="${ctx}/css/bootstrap.min.css" rel="stylesheet" />
  <link rel="stylesheet" href="${ctx}/css/font-awesome.min.css" />
  <!-- page specific plugin styles -->
  <link rel="stylesheet" href="${ctx}/css/jquery-ui-1.10.3.custom.min.css" />
  <link rel="stylesheet" href="${ctx}/css/bootstrap-timepicker.css" />

  <!-- ace styles -->
  <link rel="stylesheet" href="${ctx}/css/ace.min.css" />
  <link rel="stylesheet" href="${ctx}/css/ace-rtl.min.css" />
  <link rel="stylesheet" href="${ctx}/css/ace-skins.min.css" />
  <!-- fonts -->
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />
  <!--my css-->
  <link rel="stylesheet" href="${ctx}/css/base.css">
  <link rel="stylesheet" href="${ctx}/css/style.css">
  <!-- ace settings handler -->
  <script src="${ctx}/js/ace-extra.min.js"></script>
  <script type="text/javascript" src="${ctx}/js/jquery-1.10.2.min.js"></script>
  <script src="${ctx}/assets/admin/LingUI/js/jquery.backstretch.min.js"></script>
  <script src="${ctx}/assets/admin/LingUI/js/jquery/jquery-form.js" type="text/javascript"></script>
  <script type="text/javascript" src="${ctx}/assets/admin/LingUI/js/jsutil/browser.js"></script>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <style>
    /*密码强度*/
    .pw-strength {clear: both;position: relative;top: 8px;width: 180px;}
    .pw-bar{background: url(${ctx}/images/pwd-1.png) no-repeat;height: 14px;overflow: hidden;width: 179px;}
    .pw-bar-on{background:  url(${ctx}/images/pwd-2.png) no-repeat; width:0; height:14px;position: absolute;top: 1px;left: 2px;transition: width .5s ease-in;-moz-transition: width .5s ease-in;-webkit-transition: width .5s ease-in;-o-transition: width .5s ease-in;}
    .pw-weak .pw-defule{ width:0;}
    .pw-weak .pw-bar-on {width: 60px;}
    .pw-medium .pw-bar-on {width: 120px;}
    .pw-strong .pw-bar-on {width: 179px;}
    .pw-txt {padding-top: 2px;width: 180px;overflow: hidden;}
    .pw-txt span {color: #707070;float: left;font-size: 12px;text-align: center;width: 58px;}
  </style>
</head>
<body>
<%--<div class="topk">
  <div class="top">
    <div class="top-fl">
      <div class="logo" style="margin-top:6px; ">
        &lt;%&ndash;<img src="${base}/assets/admin/LingUI/login/images/logor.png"/>&ndash;%&gt;
        <span style="line-height: 50px;font-family: '微软雅黑';font-size:24px;color:#004A90">企业级协同工作云平台</span>
        &nbsp;&nbsp;|&nbsp;&nbsp;<span style="line-height: 50px;font-family: '微软雅黑';font-size:18px;color:#004A90">重置密码</span>
      </div>
    </div>
    <div class="top-fr1">
      <a href="${ctx}/login" style="color:#3d3d3d;float:right;margin-top: 20px;font-size: 14px">返回登录</a>
    </div>
  </div>
</div>

<div class="login-con" style="text-align: center">
  <div class="psaadiv">
    <div class="psaadivt">重置密码</div>
    <form id="mimaform">
      <div class="passform" style="margin-top:10px;height:160px;">
       <input id="pass1" class="input-style" type="password" size="20" maxlength="20" name="newPwd"  placeholder="请输入密码"    onblur="mycount(this);"/>
        <div>
          <div id="level" class="pw-strength">
            <div class="pw-bar"></div>
            <div class="pw-bar-on"></div>
            <div class="pw-txt">
              <span>弱</span>
              <span>中</span>
              <span>强</span>
            </div>
          </div>
        </div>
      &lt;%&ndash;  <input class="passinput" id="pass1" type="password"  name="newPwd"  placeholder="请输入密码" />&ndash;%&gt;
        <input class="passinput"   class="input-style" id="pass2" type="password"  name="confirmNewPwd"  placeholder="请再次输入密码" />
      </div>
      <input type="hidden" name="uid" value="${param.uid}" />
    </form>
    <input class="passbut" type="submit"  id="passset" value="确认并返回登录" />
  </div>
</div>
<div style="display: none"><span id="mes">3</span></div>--%>
<div class="bg" >
  <div class="container">
    <div class="toph">
      <div class="top_l">
        <img src="${ctx}/images/logo.png" alt="">
        <span>"科学"号线上运行管理平台 | 找回密码</span>
      </div>
      <div class="top_r">
        <span><a href="${ctx}/login">返回登录</a></span>
      </div>
    </div>
    <div class="rigis_m" style="height:290px;">
    <div class="inn_box" style="width:470px;margin:0 auto">
      <div class="in_b">
           <form id="mimaform">
             <div class="passform" style="margin-top:10px;height:160px;">
               <input id="pass1" class="input-style" type="password" size="20" maxlength="20" name="newPwd"  placeholder="请输入密码"    onblur="mycount(this);"/>
               <div>
                 <div id="level" class="pw-strength" style="margin-left:40px;">
                   <div class="pw-bar"></div>
                   <div class="pw-bar-on"></div>
                   <div class="pw-txt">
                     <span>弱</span>
                     <span>中</span>
                     <span>强</span>
                   </div>
                 </div>
               </div>
               <input class="passinput"   class="input-style" id="pass2" type="password"  name="confirmNewPwd"  placeholder="请再次输入密码" />
             </div>
             <input type="hidden" name="uid" value="${param.uid}" />
           </form>
      </div>
      <div class="in_b">
        <input class="passbut" type="submit"  id="passset" value="确认并返回登录"  style="margin-left:40px;width:180px;height:54px;background:#4b83b2;border:0;border-radius: 5px;font-size: 14px;color:#fff;margin-top:150px;"/>
        <div style="display: none"><span id="mes">3</span></div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript" src="${ctx}/assets/admin/LingUI/login/js/jquery.tips.js"></script>
<script type="text/javascript" src="${ctx}/assets/admin/LingUI/login/js/base64.js"></script>
<script src="${ctx}/assets/admin/LingUI/js/layer/layer.js" type="text/javascript"></script>
<script src="${ctx}/assets/admin/LingUI/js/layer/layer.lui.js" type="text/javascript"></script>
<script type="text/javascript">
  $(function () {
    var hehh = '';
    hehh = ($(window).height()- 497)/2;
    $.backstretch("${base}/assets/admin/LingUI/login/images/beijing.png");
    $('.psaadiv').css('margin-top',hehh);

  $('#pass1').keyup(function () {
    var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
    var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
    var enoughRegex = new RegExp("(?=.{6,}).*", "g");

  if (false == enoughRegex.test($(this).val())) {
    $('#level').removeClass('pw-weak').removeClass('pw-medium').removeClass('pw-strong').addClass('pw-defule');

  //密码小于六位的时候，密码强度图片都为灰色
  }
  else if (strongRegex.test($(this).val())) {
    $('#level').removeClass('pw-weak').removeClass('pw-medium').removeClass('pw-strong').addClass('pw-strong');

  //密码为八位及以上并且字母数字特殊字符三项都包括,强度最强
  }
  else if (mediumRegex.test($(this).val())) {
    $('#level').removeClass('pw-weak').removeClass('pw-medium').removeClass('pw-strong').addClass('pw-medium');

  //密码为七位及以上并且字母、数字、特殊字符三项中有两项，强度是中等
  }
  else {
    $('#level').removeClass('pw-weak').removeClass('pw-medium').removeClass('pw-strong').addClass('pw-weak');

  //如果密码为6为及以下，就算字母、数字、特殊字符三项都包括，强度也是弱的
  }
  return true;
  });
});
  function mycount(obj){
    if(obj.value.length<6){
      lui.warn('请输入6位-20位的密码！');
      return false;
    }
  }

  $('#passset').on('click', function () {
    if($('#pass1').val() != "") {
      if($('#pass1').val().length<6){
        lui.warn('请输入6位-20位的密码！');
        return false;
      }
      else{
        if($('#pass1').val() != $('#pass2').val()){
          lui.fail('请两次输入密码保持一致！');
          return;
        }
        $('#mimaform').ajaxSubmit({
          url: "${ctx}/resetpwd",
          type: "post",
          dataType: 'json',
          success: function (data) {
            if (data.success) {
              debugger;
              $('#pass1').val('');
              $('#pass2').val('');
              lui.success('密码重置成功！');
              var i = 3;
              var intervalid;
              intervalid = setInterval("fun(3)", 1000);

            }
            else {
              lui.fail('密码重置失败！');
              return false;
            }
          },
          error:function(){
            lui.fail('密码重置失败！');
            return false;
          }
        });
      }

    }
    else {
      lui.fail('请输入密码！');
      return false;
    }
  });
  function fun(i) {
    debugger;
    document.getElementById("mes").innerHTML = i;
    if (i == 3) {
      location.href = "${ctx}/login";
      clearInterval(intervalid);
    }

  }
</script>
</body>
</html>
